import com.shujia.util.JDBCUtil;
import org.junit.Test;

import java.io.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class test {
    public static void main(String[] args) throws Exception{
        Connection conn = JDBCUtil.getConn();
        String sql="select * from student";
        PreparedStatement ps = conn.prepareStatement(sql);
        ResultSet rs = ps.executeQuery();
        while (rs.next()){
            String name = rs.getString("name");
            String age = rs.getString("age");
            System.out.println(name+"------"+age);
        }

        JDBCUtil.closeAll(conn,ps,rs);
    }

    @Test
    public void myTest() throws IOException {
        File file = new File("F:/phone.txt");
        File file1 = new File("F:/phone2.txt");
        BufferedReader br = new BufferedReader(new FileReader(file));
        FileOutputStream fileOutputStream = new FileOutputStream(file1);
        String s=null;
        String line=null;
        while ((s=br.readLine())!=null){
            String[] split = s.toString().split("\t");
            line=split[0]+"\t"+split[1]+"\t"+split[2]+"\t"+split[3]+"\t"+split[4]+"\t"+split[5]+"\t"+split[6]+"\t"+split[7]+"\t"+split[8]+"\n";
            fileOutputStream.write(line.getBytes());
            System.out.println(split[1]+"/"+split[2]+"/"+split[3]+"/"+split[4]+"/"+split[5]);
        }
        fileOutputStream.close();
    }

}
